package org.geekbang.thinking.in.spring.conversion.aspectj;

import org.geekbang.thinking.in.spring.conversion.aspectj.service.Hello;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@Configuration
@EnableAspectJAutoProxy
@ComponentScan("org.geekbang.thinking.in.spring.conversion.aspectj")
public class Application {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(Application.class);

        Hello hello = applicationContext.getBean("springHello", Hello.class);
        System.out.println(hello.say(new StringBuffer("My Friend. ")));
        System.out.println(hello.say(new StringBuffer("My Friend1. ")));
        System.out.println(hello.say(new StringBuffer("My Friend2. ")));

    }
}
